package com.itqf.config;

import com.itqf.pojo.User;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

/**
 * projectName: springframeworkgp8
 *
 * @author: 赵伟风
 * time: 2021/8/3 9:49
 * description: 配置类+'标签'方法
 */
@Configuration
public class PojoConfiguration {

    /**
     * ioc
     * <bean id  class lazy init destroy scope
     *    <property name  value
     */

    @Bean(initMethod = "init",destroyMethod = "destroy")
    @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    @Lazy //lazy延迟加载
    public User createUser(){

        User user = new User();
        //di
        user.setName("二狗子");
        user.setAge(22);
        return user;
    }


}
